package thread.consurrent;

import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @program: Multhread
 * @description: 测试concurrentHashMap
 * @author: zhanghz001
 * @create: 2021-03-05 14:15
 **/
public class CurrentHashMapDemo1 {
    public static void main(String[] args) throws InterruptedException {
        ConcurrentHashMap<String, Integer> map = new ConcurrentHashMap<>();
        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                map.put(UUID.randomUUID().toString(), 1);
            }).start();
        }
        Thread.sleep(1000);
        System.out.println(map);
        
    }
}
